package org.nanhill.commons.math;

public class Divisor {

	/**
	 * Get Greatest Common Divisor
	 * 
	 * 欧几里德辗转相除法
	 * 
	 * @param i
	 * @param j
	 * @return
	 */
	public static int getGreatestCommonDivisor(int i, int j) {
		while (i != 0 && j != 0) {
			if (i > j)
				i %= j;
			else
				j %= i;
		}
		return i + j;
	}

}
